package com.blog.controller;

import com.blog.config.CommonConfigPath;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName BaseeConfigController
 * @Destription 获取远程配置中心
 * @Author 天堂小野花
 * @Date 2025/8/16  10:40
 * @Version 1.0
 */
@RestController
@RequestMapping("/config")
public class BaseeConfigController {
    @Autowired
    CommonConfigPath commonConfigPath;
    @GetMapping("/getNacosConfig")
    public  List<Map<String,String>>  getNacosConfig(){
        List<Map<String,String>> list=new ArrayList<Map<String,String>>();



        Map<String,String> mapGitee = new HashMap<String, String>();
        mapGitee.put("name","Gitee后端代码");
        mapGitee.put("address",commonConfigPath.getGiteeAddress());
        list.add(mapGitee);
        Map<String,String> mapGiteeBefore = new HashMap<String, String>();
        mapGiteeBefore.put("name","Gitee前端代码");
        mapGiteeBefore.put("address",commonConfigPath.getGiteebefAddress());
        list.add(mapGiteeBefore);
        Map<String,String> mapFadada= new HashMap<String, String>();
        mapFadada.put("name","法大大沙箱");
        mapFadada.put("address",commonConfigPath.getFadadaAddress());
        list.add(mapFadada);

        Map<String,String> mapAliyun= new HashMap<String, String>();
        mapAliyun.put("name","阿里云服务器");
        mapAliyun.put("address",commonConfigPath.getAliyunAddress());
        list.add(mapAliyun);
        Map<String,String> mapFile = new HashMap<String, String>();
        mapFile.put("name","远程文件服务器");
        mapFile.put("address",commonConfigPath.getFileAddress());
        list.add(mapFile);
        Map<String,String> mapNacos = new HashMap<String, String>();
        mapNacos.put("name","NACOS服务配置中心");
        mapNacos.put("address",commonConfigPath.getNacosAddress());
        list.add(mapNacos);
        Map<String,String> mapSeata = new HashMap<String, String>();
        mapSeata.put("name","Seata配置中心");
        mapSeata.put("address",commonConfigPath.getSeataAddress());
        list.add(mapSeata);

        return list ;
    }
}
